amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 15 Aug 2022 07:57:23 +0000 (09:57 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 19 Aug 2022 19:22:22 +0000 (20:22 +0100)
commit8ffd5496f46425f73771200f2b51087b794be553
tree4d6b2473cfcb0155f8f0bbb30385f342c6cae947
parent8c5d17f5a48ea2cd4cac27b6ae414c0946d4eda8
amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL

Use the logic to set shadow SPEC_CTRL values in order to implement
support for VIRT_SPEC_CTRL (signaled by VIRT_SSBD CPUID flag) for HVM
guests. This includes using the spec_ctrl vCPU MSR variable to store
the guest set value of VIRT_SPEC_CTRL.SSBD, which will be OR'ed with
any SPEC_CTRL values being set by the guest.

On hardware having SPEC_CTRL VIRT_SPEC_CTRL will not be offered by
default to guests. VIRT_SPEC_CTRL will only be part of the max CPUID
policy so it can be enabled for compatibility purposes.

Use '!' to annotate the feature in order to express that the presence
of the bit is not directly tied to its value in the host policy.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Re-commited with a tag removed.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/cpuid.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/include/asm/msr.h
xen/arch/x86/msr.c
xen/arch/x86/spec_ctrl.c
xen/include/public/arch-x86/cpufeatureset.h